package com.itcast;

import com.itcast.Dao.UserDao;
import com.itcast.Service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import javax.sql.DataSource;

public class App {
    public static void main(String[] args) {
//        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
//        DataSource dataSource = (DataSource) ctx.getBean("dataSource");
//        System.out.println(dataSource);
        ApplicationContext ctx=new FileSystemXmlApplicationContext("D:\\Java\\gitee\\text\\ssm\\spring06_datasource\\src\\main\\resources\\applicationContext.xml");
//        UserDao userDao = (UserDao) ctx.getBean("userDao");
//        userDao.save();
        UserService userService = ctx.getBean(UserService.class);
        userService.save();
    }
}
